#ifndef _CLEANER_H
#define _CLEANER_H

#include <stdint.h>

//work

//命令编号 平台端
enum{
    SETTIME_COMM_ID =100,
    TIMEQUE_COMM_ID,
    ONOFF_COMM_ID,
    SET_PLACE_COMM_ID
};

typedef enum{
    STA_DEFAULT = 0,
    NO_WORK,
    WORKING,
    IDLE
}workstate;

typedef char workplace;

typedef uint16_t starttime;
#define START_TIME_DEFAULT  1500

#define WORKPLACE_LEN 30
typedef struct 
{
    /* data */
    starttime TargetStartTime;
    starttime CarStartTime;
    workstate WorkState;
    workplace WorkPlace[WORKPLACE_LEN];  //与平台一致，不超过WORKPLACE_LEN个字符
}work;

//battery

//命令编号 平台端
enum{
    VALQUE_COMM_ID =200,
    CHARGE_COMM_ID
};

typedef enum {
    CHA_DEFAULT = 5,
    NO_CHAERGE,  //需要充电却没有充电
    CHARGING,
    CHARGED   //不需要充电
}chargestate;
#define BAT_VAL_DEFAULT 50

typedef float currentval;

typedef struct 
{
    /* data */
    currentval CurrentVal;
    chargestate ChargeState;
}battery;



//cleaner

typedef struct 
{
    /* data */
    work Work;
    battery Battery;
}cleaner;



// about nvs
#define WORK_PLACE_KEY "work_place"
#define WORK_STARTTIME_KEY "starttime"

cleaner* get_cleaner(void);
esp_err_t get_cleanerConfig_from_nvs(cleaner* pCleanerCar);
esp_err_t store_cleanerConfig_to_nvs(cleaner* pCleanerCar);

esp_err_t store_cleaner_place_to_nvs(cleaner* pCleanerCar);
esp_err_t store_cleaner_time_to_nvs(cleaner* pCleanerCar);

#endif  // _CLEANER_H
